Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

전남대 FE_이도현_3주차 과제 #51

Open
wants to merge 15 commits into
base: leedyun
Choose a base branch
from

Conversation

leedyun
Copy link

@leedyun leedyun commented Jul 11, 2024

3주차 과제 step4까지 제출합니다.

src/api/api.tsx Outdated
import axios from 'axios';
import { useQuery } from 'react-query';

import type {GoodsData,InfiniteQueryResponse,ThemeData } from '@/types';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import type {GoodsData,InfiniteQueryResponse,ThemeData } from '@/types';
import type { GoodsData,InfiniteQueryResponse,ThemeData } from '@/types';

}


export const fetchRankingProducts = async (targetType: string, rankType: string): Promise<GoodsData[]> => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api 호출의 성공 실패시 핸들링은 추가해주신 react-query 에서만 수행하면 될 거 같습니다.
여기서는 api 함수만 정의해주시면 될 거 같아요.

const fetchRankingProducts = await axiosInstance.get('api/v1/ranking/products', {
  params: { targetType, rankType }
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 fetchThemeProducts, fetchTheme 도 마찬가지 입니다.

['rankingProducts', filterOption],
() => fetchRankingProducts(filterOption.targetType, filterOption.rankType),
{
keepPreviousData: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이전 데이터를 사용하지 않는데 해당 플래그는 왜 true 로 설정했을까요 ?

const [themes, setThemes] = useState<ThemeData[]>([]);

useEffect(() => {
const loadThemes = async () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 api 도 react-query 사용하면 되지 않을까요 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 멘토님 항상 피드백 감사합니다. 피드백 주신 내용은 모두 수정했습니다
(아마 위에 플래그나 지저분한 코드의 문제는 문제 해결 도중 에러가 뜰 때 이것저것 만져보고 안 되돌려서 생긴 문제같습니다:) )
추가적인 피드백 내용 있으면 알려주세요! 감사합니다!
(혹시 merge는 안 해주시는건가요..? 1주차때부터 머지가 안 되어있어서... 제가 추가로 코드를 더 수정해야하는걸까요?)

@leedyun leedyun requested a review from tlsehdfl July 13, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants